Skip to content

Fix Service Bus session trace propagation in OpenTelemetry - #11946

Open
Rohit Ranjan (RohitRanjanMS) wants to merge 3 commits into
devfrom
rohitranjanms-fix-service-bus-session-tracing
Open

Fix Service Bus session trace propagation in OpenTelemetry#11946
Rohit Ranjan (RohitRanjanMS) wants to merge 3 commits into
devfrom
rohitranjanms-fix-service-bus-session-tracing

Conversation

@RohitRanjanMS

Copy link
Copy Markdown
Member

Issue describing the changes in this PR

Resolves #11734

Pull request checklist

IMPORTANT: Currently, changes must be backported to the in-proc branch to be included in Core Tools and non-Flex deployments.

  • Backporting to the in-proc branch is not required
    • Backport PR will follow after this change merges.
  • My changes do not require documentation changes
  • My changes should not be added to the release notes for the next release
  • My changes do not need to be backported to a previous version
  • My changes do not require diagnostic events changes
  • I have added all required tests (Unit tests, E2E tests)

Additional information

Registers the Azure.Messaging.ServiceBus.ServiceBusSessionProcessor activity source so session-enabled Service Bus triggers preserve W3C trace context in OpenTelemetry mode.

Validated with a private site extension against a session-enabled Service Bus trigger: the stock host omitted the session processor request and broke the producer trace, while the patched host emitted ServiceBusSessionProcessor.ProcessSessionMessage with the producer operation ID.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e01f6e03-4761-4eeb-9d24-e2522eb0f446
@RohitRanjanMS
Rohit Ranjan (RohitRanjanMS) requested a review from a team as a code owner August 27, 2026 06:01
Copilot AI lite review requested due to automatic review settings August 27, 2026 06:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a distributed tracing gap in Functions Host OpenTelemetry integration by ensuring session-enabled Service Bus triggers are instrumented via the correct ActivitySource, preserving W3C trace context.

Changes:

  • Added Azure.Messaging.ServiceBus.ServiceBusSessionProcessor to the host’s OpenTelemetry ActivitySource allowlist.
  • Introduced a constant for the Service Bus session processor ActivitySource name.
  • Added a unit test validating that an activity can be started for the session processor source (i.e., a listener is registered).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
test/WebJobs.Script.Tests/Diagnostics/OpenTelemetry/OpenTelemetryConfigurationExtensionsTests.cs Adds coverage to validate the host listens to the Service Bus session processor ActivitySource.
src/WebJobs.Script/Diagnostics/OpenTelemetry/OpenTelemetryConstants.cs Introduces a constant for the Service Bus session processor ActivitySource name.
src/WebJobs.Script/Diagnostics/OpenTelemetry/OpenTelemetryConfigurationExtensions.cs Subscribes to the Service Bus session processor ActivitySource during tracing configuration.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e01f6e03-4761-4eeb-9d24-e2522eb0f446
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e01f6e03-4761-4eeb-9d24-e2522eb0f446
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

W3C trace context not propagated for session-enabled Service Bus triggers (OpenTelemetry)

4 participants